import type { UploadUserFile } from "element-plus";
export interface GetSpuListParams {
  page: number;
  limit: number;
  category3Id: number;
}
// "data": {
//   "records": [{
//   "id": 9390,
//   "spuName": "色蓝",
//   "description": "45456661",
//   "category3Id": 1,
//   "tmId": 24405,
//   "spuSaleAttrList": null,
//   "spuImageList": null
// }],
//   "total": 3,
//   "size": 4,
//   "current": 1,
//   "searchCount": true,
//   "pages": 0
// },
export interface SpuItem {
  id: number;
  spuName: string;
  description: string;
  tmId: number;
}
export type SpuList = SpuItem[];
export interface GetSpuListResponse {
  records: SpuList;
  total: number;
}
// 基础销售属性的ts
// [
//   {
//     "id": 1,
//     "name": "颜色"
//   },]
export interface saleAttrItem {
  id: number;
  name: string;
}
export type GetSaleAttrList = saleAttrItem[];
/*  添加某些条件需要的ts
{
  "spuName": "string",
  "category3Id": 0,
  "description": "string",
  "spuImageList": [
    {
      "imgName": "string",
      "imgUrl": "string",
    }
  ],
  "spuSaleAttrList": [
    {
      "baseSaleAttrId": 0,
      "saleAttrName": "string",
      "spuSaleAttrValueList": [
        {
          "baseSaleAttrId": 0,
          "saleAttrValueName": "string",
        }
      ]
    }
  ],
  "tmId": 0
}*/
/*  修改attr
{
  "spuName": "string",
  "category3Id": 0,
  id:0
  "description": "string",
  "spuImageList": [
    {
      "id":0
      "imgName": "string",
      "imgUrl": "string",
    }
  ],
  "spuSaleAttrList": [
    {
      "id":0
      "baseSaleAttrId": 0,
      "saleAttrName": "string",
      "spuSaleAttrValueList": [
        {
          "id":0
          "baseSaleAttrId": 0,
          "saleAttrValueName": "string",
        }
      ]
    }
  ],
  "tmId": 0
}
*/
/* 组件需要 
  "spuName": "string",
  "description": "string",
  "spuImageList": [
    {
      "imgName": "string",
      "imgUrl": "string",
    }
  ],
  "spuSaleAttrList": [
    {
      "baseSaleAttrId": 0,
      "saleAttrName": "string",
      "spuSaleAttrValueList": [
        {
          "baseSaleAttrId": 0,
          "saleAttrValueName": "string",
        }
      ]
    }
  ],
  "tmId": 0
*/
export interface SpuSaleAttrValueItem {
  baseSaleAttrId: number;
  saleAttrValueName: string;
}
export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];
export interface SpuSaleAttrItem {
  id?: number;
  baseSaleAttrId: number;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
  isEdit?: boolean;
}
export type SpuSaleAttrList = SpuSaleAttrItem[];
export interface SpuCommon {
  id?: number;
  spuName: string;
  description: string;
  spuSaleAttrList: SpuSaleAttrList;
}
export interface SpuImageListItem {
  id?: number;
  imgName: string;
  imgUrl: string;
}
export type SpuImageList = SpuImageListItem[];

export interface AddOrUpdateSpu extends SpuCommon {
  tmId: number;
  category3Id: number;
  spuImageList: SpuImageList;
}
export interface SpuFormData extends SpuCommon {
  tmId: undefined | number;
  spuImageList: UploadUserFile[];
}
